package collections;

import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.util.List;
import java.util.Set;
import java.util.TreeSet;

public class UniqueWords {
    public  static  void main (String[] args) throws  Exception{
        List<String> lines = Files.readAllLines(Paths.get("SortedSetOfString.java"));
        Set<String> words = new TreeSet<>();
        for(String line :lines){
            for(String word:line.split("\\w+")){
                if(word.trim().length()>0){
                    words.add(word);
                }

            }

        }
        System.out.println(words);

    }
}
